package list.offer.simple;

import list.ListNode;

public class LOCF_06 {

    public int[] reversePrint(ListNode head) {
        ListNode cur = head;
        int count = 0;
        while (cur != null) {
            count++;
            cur = cur.next;
        }
        cur = head;
        int[] res = new int[count];
        for (int i = count - 1; i >= 0 ; i--) {
            res[i] = cur.val;
            cur = cur.next;
        }
        return res;
    }
}
